package com.workflow.workflowproject.entity;

import com.alibaba.fastjson2.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import com.mybatisflex.core.keygen.KeyGenerators;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

@Data
@Table(value = "t_com_flow_version")
public class FlowVersion implements Serializable {

    private static final long serialVersionUID = 7581480688460328627L;

    @Id(keyType = KeyType.Auto)
    private Integer id;

    @Column(value = "file_id")
    @Schema(description = "流程文件id")
    private Long fileId;

    @Column(value = "name")
    @Schema(description = "版本名称")
    private String name;

    @Column(value = "state")
    @Schema(description = "状态（0、上架；1、下架）")
    private Integer state;

    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(value = "create_time",onInsertValue = "now()")
    @Schema(description = "创建时间")
    private Date createTime;


    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(value = "update_time",onUpdateValue = "now()")
    @Schema(description = "修改时间")
    private Date updateTime;

    @Column(value = "exist",isLogicDelete = true)
    @Schema(description = "是否删除")
    private Integer exist;
}
